package com.gurun.codes.business.home;

import android.content.Context;
import android.databinding.DataBindingUtil;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.gurun.base.DebounceObservableTransformer;
import com.gurun.codes.R;
import com.gurun.codes.databinding.ItemHomeRoomListBinding;
import com.gurun.codes.databinding.ItemHomeTaskListBinding;
import com.gurun.codes.utils.ScreenUtils;
import com.gurun.model.bean.home.GetRoomListResultBean;
import com.gurun.model.bean.home.GetTaskListResultBean;
import com.jakewharton.rxbinding2.view.RxView;

import io.reactivex.functions.Consumer;

class TaskListtemViewBinder extends me.drakeet.multitype.ItemViewBinder<GetTaskListResultBean.SmartTaskListBean, TaskListtemViewBinder.ViewHolder> {

    private Context mContext;
    private MainActivityContract.MainActivityView mMainActivityView;

    public TaskListtemViewBinder(Context context, MainActivityContract.MainActivityView mainActivityView) {
        mContext = context;
        mMainActivityView = mainActivityView;
    }

    @NonNull
    @Override
    protected ViewHolder onCreateViewHolder(@NonNull LayoutInflater inflater, @NonNull ViewGroup parent) {
        View view = inflater.inflate(R.layout.item_home_task_list, parent, false);
        return new ViewHolder(view);
    }

    @Override
    protected void onBindViewHolder(@NonNull ViewHolder holder, @NonNull GetTaskListResultBean.SmartTaskListBean item) {
        holder.bindData(item);
    }

    class ViewHolder extends RecyclerView.ViewHolder {

        private GetTaskListResultBean.SmartTaskListBean mData;
        private ItemHomeTaskListBinding mBinding;

        public ViewHolder(View itemView) {
            super(itemView);
            mBinding = DataBindingUtil.bind(itemView);
        }


        public void bindData(GetTaskListResultBean.SmartTaskListBean item) {
            mData = item;
            if (mData != null) {
                mBinding.setData(item);
            }
        }
    }
}
